*This file runs the regressions for Table A4




**Table A4, Panel A: Additional Robustness, did_multiplegt estimator
*******************************************************************************
*******************************************************************************

preserve
keep if yr ==5 //This keeps only observations where a full panel of well observations is available

*No rez-t controls; groundwater sample
did_multiplegt agpct ID	 year post, placebo(2) dynamic(2) trends_nonparam(StateCode) cluster(TOWNSHIP) breps(10) seed(10)   robust_dynamic longdiff_placebo covariances average_effect graphoptions (ytitle(Agriculture (%)) graphregion(color(white))  ysize(15) xtitle(Time to Treatment) xsize(20) yline(0, lpattern(dash) lcolor(gs10)) legend(off) ) 


*all rez-t controls;  groundwater sample
did_multiplegt agpct ID	 year post, placebo(2) dynamic(2) trends_nonparam(StateCode) cluster(TOWNSHIP) breps(10) seed(10) controls(offrespop has_casino has_credit ) robust_dynamic longdiff_placebo covariances average_effect graphoptions (ytitle(Agriculture (%)) xtitle(Time to Treatment) graphregion(color(white))  ysize(15) xsize(20) xline(-.5) legend(off)) 

*No rez-t controls; groundwater control
did_multiplegt agpct ID	 year post, placebo(2) dynamic(2) trends_nonparam(StateCode) cluster(TOWNSHIP) breps(10) seed(10) controls(med_depth) robust_dynamic longdiff_placebo covariances average_effect graphoptions (ytitle(Agriculture (%)) xtitle(Time to Treatment) graphregion(color(white))  ysize(15) xsize(20) xline(-.5) legend(off)) 


*all rez-t controls;  groundwater control
did_multiplegt agpct ID	 year post, placebo(2) dynamic(2) trends_nonparam(StateCode) cluster(TOWNSHIP) breps(10) seed(10) controls(offrespop has_casino has_credit med_depth) robust_dynamic longdiff_placebo covariances average_effect graphoptions (ytitle(Agriculture (%)) xtitle(Time to Treatment) graphregion(color(white))  ysize(15) xsize(20) xline(-.5) legend(off)) 

restore

*No rez-t controls; start date-by-year FE
did_multiplegt agpct ID	 year post, placebo(2) dynamic(2) trends_nonparam(STARTDUM) cluster(TOWNSHIP) breps(10) seed(10)   robust_dynamic longdiff_placebo covariances average_effect graphoptions (ytitle(Agriculture (%)) graphregion(color(white))  ysize(15) xtitle(Time to Treatment) xsize(20) yline(0, lpattern(dash) lcolor(gs10)) legend(off) ) 


*all rez-t controls;  start date-by-year FE
did_multiplegt agpct ID	 year post, placebo(2) dynamic(2) trends_nonparam(STARTDUM) cluster(TOWNSHIP) breps(10) seed(10) controls(offrespop has_casino has_credit ) robust_dynamic longdiff_placebo covariances average_effect graphoptions (ytitle(Agriculture (%)) xtitle(Time to Treatment) graphregion(color(white))  ysize(15) xsize(20) xline(-.5) legend(off)) 



**Table A4, Panel B: Additional Robustness, csdid estimator
*******************************************************************************
*******************************************************************************



preserve
*keep if dropthis ==0  //Drops 206 observations that appear only in 2012 due to GIS processing issues (creates a balanced panel, other estimates do this automatically)

eststo clear
*Baseline with no rezxt controls: groundwater sample
csdid agpct if yr ==5, ivar(ID) time(t) gvar(TG)  cluster(TOWNSHIP) agg(simple) drimp


*all rez-t controls: groundwater sample
csdid agpct offrespop has_casino has_credit  if yr ==5, ivar(ID) time(t) gvar(TG)  cluster(TOWNSHIP) agg(simple) drimp

*Baseline with no rezxt controls: groundwater control
csdid agpct med_depth if yr ==5, ivar(ID) time(t) gvar(TG)  cluster(TOWNSHIP) agg(simple) drimp



restore

**Table A4, Panel C: Additional Robustness, twfe estimator
*******************************************************************************
*******************************************************************************


preserve

keep if yr ==5
eststo clear
*Baseline with no rezxt controls: groundwater sample
reghdfe agpct post , absorb(ID stateXyear ) cluster(TOWNSHIP)
est sto twfe_alt_1

*all rez-t controls: Y=  groundwater sample
reghdfe agpct post offrespop has_c* ,  absorb(ID stateXyear ) cluster(TOWNSHIP)
est sto twfe_alt_2

*Baseline with no rezxt controls: groundwater control
reghdfe agpct post med_depth, absorb(ID stateXyear ) cluster(TOWNSHIP)
est sto twfe_alt_3

*all rez-t controls: Y=  groundwater control
reghdfe agpct post offrespop has_c* med_depth,  absorb(ID stateXyear ) cluster(TOWNSHIP)
est sto twfe_alt_4


restore


*Baseline with no rezxt controls: start date-by-year FE
reghdfe agpct post , absorb(ID startXyear ) cluster(TOWNSHIP)
est sto twfe_alt_5

*all rez-t controls: start date-by-year FE
reghdfe agpct post offrespop has_c* ,  absorb(ID startXyear ) cluster(TOWNSHIP)
est sto twfe_alt_6

esttab twfe_alt_1 twfe_alt_2 twfe_alt_3 twfe_alt_4 twfe_alt_5 twfe_alt_6 ,  se(a3) b(a3) star(* 0.1 ** 0.05 *** 0.01) ar2  replace   scalar(N_clust M1 MDV)


